<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:template match="text">
    <xsl:apply-templates select="text() | bold | italic | link | slink | image | inlineimage | columns | newline | proversion | list | note"/>
 </xsl:template>
 <xsl:template match="note">
 	<div style="border: 1px solid red; background-color: #ffcc99; margin-top: 7px; margin-bottom: 7px; padding: 5px">
 	<b>Wichtig:</b><br/>
    <xsl:apply-templates select="text() | bold | italic | link | slink | image | inlineimage | columns | newline | list"/>
    </div>
 </xsl:template>
 <xsl:template match="bold">
     <b><xsl:apply-templates select="text() | italic | bold | slink | image | inlineimage | columns | newline"/></b>
 </xsl:template>
 <xsl:template match="italic">
     <i><xsl:apply-templates select="text() | italic | bold | link | slink | image | inlineimage | columns | newline"/></i>
 </xsl:template>
 <xsl:template match="link">
     <xsl:variable name="ref" select="@ref"/>
     <xsl:variable name="ch" select="@ch"/>
     <xsl:variable name="par" select="@par"/>
     <xsl:choose>
     	<xsl:when test="@ch">
	    	<a href="{$scriptname}/help/show/{$ref}#{$ch}{$par}"><xsl:apply-templates select="text() | italic | bold | link | slink | newline"/></a>
	    </xsl:when>
        <xsl:otherwise>
	    	<a href="{$scriptname}/help/show/{$ref}"><xsl:apply-templates select="text() | italic | bold | link | slink | newline"/></a>
        </xsl:otherwise>
     </xsl:choose>
 </xsl:template>
 <xsl:template match="slink">
     <xsl:variable name="ref" select="@ref"/>
     <xsl:variable name="ch" select="@ch"/>
     <xsl:variable name="par" select="@par"/>
     <a href="{$scriptname}/help/select/{$ref}/{$ch}/{$par}"><xsl:apply-templates select="text() | italic | bold | link | slink | newline"/></a>
 </xsl:template>
 <xsl:template match="image">
     <xsl:variable name="src" select="@src"/>
     <xsl:variable name="width" select="@width"/>
     <div style="margin-left: 50%; margin-bottom: 30px; margin-top: 30px">
     <div class="image" style="width: {$width}px; margin-left: -{round($width div 2)}px">
         <div style="width: 100%; border: 1px solid black; margin-bottom: 5px; background-color: white">
         <img src="{$scriptname}/help/image/{$src}" style="display: block"/></div>
         <xsl:apply-templates select="text() | bold | italic | link | slink | columns | newline | list"/>
     </div>
     </div>
 </xsl:template>
 <xsl:template match="inlineimage">
     <xsl:variable name="src" select="@src"/>
     <img src="{$scriptname}/help/image/{$src}" align="top"/>
 </xsl:template>
 <xsl:template match="columns">
    <xsl:variable name="width" select="round(100 div count(column))"/>
    <xsl:variable name="spacing" select="2"/>
    <table border="0" cellpadding="0" cellspacing="0">
        <tr>
    <xsl:for-each select="column">
            <td width="{$width - $spacing}%" valign="top">
                 <h4 style="margin-bottom:3px"><xsl:value-of select="title"/></h4>
            </td>
            <xsl:if test="position()!=last()">
            <td width="{$spacing}%"></td>
            </xsl:if>
    </xsl:for-each>
        </tr>
        <tr>
    <xsl:for-each select="column">
            <td width="{$width - $spacing}%" valign="top">
                 <xsl:apply-templates select="text() | bold | italic | link | slink | image | inlineimage | newline | list"/>
            </td>
            <xsl:if test="position()!=last()">
            <td width="{$spacing}%"></td>
            </xsl:if>
    </xsl:for-each>
        </tr>
    </table>
 </xsl:template>
 <xsl:template match="newline">
     <xsl:choose>
         <xsl:when test="@margin = 'none'">
             <br/>
         </xsl:when>
         <xsl:otherwise>
             <br style="margin-bottom: 10px; display: block"/>
         </xsl:otherwise>
     </xsl:choose>
 </xsl:template>
 <xsl:template match="proversion">
     <div style="margin-left: -10px; margin-bottom: 10px; margin-top: 10px; border: 1px solid red; font-family: Helvetica, Arial; font-weight: bold; padding:10px; width: 170px; background-color: lightyellow">
         XICS Pro only feature
     </div>
 </xsl:template>
 <xsl:template match="list">
     <xsl:choose>
         <xsl:when test="@type = '1' or @type = 'A' or @type = 'a' or @type = 'I' or @type = 'i'">
             <xsl:text disable-output-escaping="yes">&lt;ol type=&quot;</xsl:text><xsl:value-of select="@type"/><xsl:text disable-output-escaping="yes">&quot;&gt;</xsl:text>
         </xsl:when>
         <xsl:when test="@type = 'disc' or @type = 'circle' or @type = 'square'">
             <xsl:text disable-output-escaping="yes">&lt;ul type=&quot;</xsl:text><xsl:value-of select="@type"/><xsl:text disable-output-escaping="yes">&quot;&gt;</xsl:text>
         </xsl:when>
         <xsl:otherwise>
             <xsl:text disable-output-escaping="yes">&lt;ul&gt;</xsl:text>
         </xsl:otherwise>
     </xsl:choose>
     <xsl:for-each select="item">
         <li><xsl:apply-templates select="text() | bold | italic | link | slink | image | inlineimage | newline | list"/></li>
     </xsl:for-each>
     <xsl:choose>
         <xsl:when test="@type = '1' or @type = 'A' or @type = 'a' or @type = 'I' or @type = 'i'">
             <xsl:text disable-output-escaping="yes">&lt;/ol&gt;</xsl:text>
         </xsl:when>
         <xsl:otherwise>
             <xsl:text disable-output-escaping="yes">&lt;/ul&gt;</xsl:text>
         </xsl:otherwise>
     </xsl:choose>
 </xsl:template>
</xsl:stylesheet>